package com.hhh.tools

import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.flow.map

suspend fun flowSample() {
    flow {
        (0..2).forEach {
            println("emit $it")
            emit(it)
        }
    }.map {
        println("running map $it")
        it * 2 + 1
    }.collect {
        println("last collect result $it")
    }
}